from rest_framework.generics import ListAPIView
from rest_framework.permissions import IsAdminUser
from rest_framework.viewsets import ModelViewSet

from goods.models import SpecificationOption, SPUSpecification
from meiduo_admin.serializers.guigexuanxiang import SpecsOptionsSerializer, GoodsSpecsSimpleSerializer


class SpecsOptionsView(ModelViewSet):
    permission_classes = [IsAdminUser]
    serializer_class = SpecsOptionsSerializer
    queryset = SpecificationOption.objects.all()


class GoodsSpecsSimpleView(ListAPIView):
    permission_classes = [IsAdminUser]
    serializer_class = GoodsSpecsSimpleSerializer
    queryset = SPUSpecification.objects.all()
    pagination_class = None
